package com.atguigu.cloud.apis;

import com.atguigu.cloud.dto.PayDto;
import com.atguigu.cloud.resp.ResultData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "cloud-gateway")
//@FeignClient(value = "cloud-payment-service")
public interface PayFeignApi {

    @PostMapping(value = "/pay/add")
    public ResultData addOrder(@RequestBody PayDto payDto);

    @GetMapping(value = "/pay/get/{id}")
    public ResultData getPayInfo(@PathVariable("id") Integer id);

//    openFeign支持负载均衡演示
    @GetMapping(value = "/pay/get/info")
    public String mylb();

//    Resilience4j CircuitBreaker 断路器
    @GetMapping(value = "/pay/circuit/{id}")
    public String myCircuit(@PathVariable("id") Integer id);

//    Resilience4j bulkhead 信号舱壁
    @GetMapping(value = "/pay/bulkhead/{id}")
    public String myBulkhead(@PathVariable("id") Integer id);

//    Resilience4j rateLimit 限流
    @GetMapping(value = "/pay/rateLimit/{id}")
    public String myRateLimit(@PathVariable("id") Integer id);

//    micrometer(sleuth) 进行链路监控
    @GetMapping(value = "/pay/micrometer/{id}")
    public String myMicrometer(@PathVariable("id") Integer id);

//    GateWay进行网关测试
    @GetMapping(value = "/pay/gateway/get/{id}")
    public ResultData getById(@PathVariable("id") Integer id);

//    GateWay进行网关测试
    @GetMapping(value = "/pay/gateway/info")
    public ResultData getGatewayInfo();

}
